package model;

/**
 * @author Alexander Shidlovsky
 */
public class Location {
	private int row;
	private int col;
	private Stack stack;
	private boolean active = false;

	public Location(int row, int col) {
		this.row = row;
		this.col = col;
		stack = null;
		active = true;
	}

	public int getRow() {
		return row;
	}

	public void setRow(int row) {
		this.row = row;
	}

	public int getColumn() {
		return col;
	}

	public void setColumn(int col) {
		this.col = col;
	}

	public Stack getStack() {
		return stack;
	}

	void setStack(Stack stack) {
		this.stack = stack;
	}

	void removeStack() {
		stack = null;
	}

	public boolean isActive() {
		return active;
	}

	/*
	 * stack should be null
	 */
	public void setActive(boolean active) {
		if (stack == null)
			this.active = active;
	}

	@Override
	public String toString() {
		return "Location " + (active ? "active" : "inactive") + " at [" + col
				+ " ; " + row + "]" + (stack != null ? " Stack: " + stack : "");
	}
}
